package com.soft.dao;

import com.soft.IBaseDao.IBaseDao;
import com.soft.pojo.Workon;
import com.soft.utils.DBUtil;

import java.util.List;

/**
 * @author ruoxi
 * @create 2021-12-26 15:59
 */
public class OnWorkDaoImpl implements IBaseDao<Workon> {
    @Override
    public int add(Workon var1) {
        return 0;
    }

    @Override
    public int del(int var1) {
        return 0;
    }

    @Override
    public int update(Workon var1) {
        return 0;
    }

    @Override
    public List<Workon> selectByAll() {
        return DBUtil.query("select * from onwork", Workon.class);
    }

    @Override
    public Workon selectByKey(Workon var1) {
        return null;
    }

    public List<Workon> selectWorkOnByPage(int currentPage,int currentCount){
        return DBUtil.query("select o.id,o.eno,o.ename,e.job,d.dName,o.startime,o.endtime from onwork o,emp e,dept d where e.deptno=d.dno and o.eno=e.eno limit ?,?", Workon.class, currentPage,currentCount);
    }

    public List<Workon> selectOnWorkerByDate(String date,int currentPage,int currentCount){
        return DBUtil.query("select o.id,o.eno,o.ename,e.job,d.dName,o.startime,o.endtime from onwork o,emp e,dept d where e.deptno=d.dno and o.eno=e.eno and (startime like ? or endtime like ?) limit ?,?", Workon.class, date,date,currentPage,currentCount);
    }
}
